#插入Sql Server数据库数据模块
import pyodbc
def insert_to_server(city,job,area,num,time):
    conn = pyodbc.connect(
        "DRIVER={ODBC Driver 17 for SQL Server};"
        "SERVER=LAPTOP-0U7HG0ED;"
        "DATABASE=pachongtest;"
        "Trusted_Connection=yes;"
    )
    # 创建了游标对象
    cursor = conn.cursor()
    cursor.execute('SELECT * FROM jianzhimao')
    sql = f"insert into jianzhimao values ('{city}','{job}','{area}',{num},'{time}')"
    # 创建了游标对象
    cursor = conn.cursor()
    cursor.execute(sql)
    conn.commit()
